package com.jiayu.wheel.dao;

import com.jiayu.wheel.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public User getById(int id){
        String sql = "select id,name,code from t_user where id = ?";
        User user = (User) jdbcTemplate.queryForObject(sql,new User(),id);
        return user;
    }

    public List<User> queryList(){
        String sql = "select id,name,code from t_user limit 100";
        List<User> list = jdbcTemplate.query(sql,new User());
        return list;
    }


}
